package com.jmpt.fangbohui.utils;

import android.content.Context;
import android.widget.Toast;

/**
 * 快捷显示toast的工具类
 * @package com.jmpt.fangbohui.utils
 * @author Victor 
 * @description:
 *
 */
public class ToastHelper {
    public static Toast mToast;

    public static void ShowToast(int resId, Context context) {
        String text = context.getString(resId);
        if (mToast == null) {
            mToast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(text);
            mToast.setDuration(Toast.LENGTH_SHORT);
        }
        mToast.show();
    }

    public static void ShowToast(String text, Context context) {
        if (mToast == null) {
            mToast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(text);
            mToast.setDuration(Toast.LENGTH_SHORT);
        }
        mToast.show();
    }
}
